package com.cds.wiki.api.controller;

import com.cds.wiki.api.entity.Ebook;
import com.cds.wiki.api.service.EbookService;
import com.cds.wiki.common.JsonResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ebook")
public class EbookController {

    private JsonResp jsonResp = new JsonResp<>();

    @Resource
    private EbookService ebookService;

    @GetMapping("/list")
    private JsonResp list() {
        List<Ebook> list = ebookService.list();
        jsonResp.setData(list);
        return jsonResp;
    }
}
